package ch.nortgram.countdown_worldcup_2014.fragment;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class ArrayListFragment extends ListFragment
	{
	String[] Listname = {"Team 1: Schweiz","Team 2: Korea","Team 3: Arabien","Team 4: Deutschland","Team 5: Spanien"};

	@Override                               
	public void onActivityCreated(Bundle savedInstanceState)
		{
		super.onActivityCreated(savedInstanceState);
		setListAdapter(new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, Listname));
		//Listnames is a class with String[] TITLES;
		}

        @Override
        public void onListItemClick(ListView l, View v, int position, long id)
        	{
            Log.i("FragmentList2", "Item clicked: " + id);
            String item = (String) getListAdapter().getItem(position);
            Toast.makeText(getActivity(), item, Toast.LENGTH_LONG).show();
        	}
    	}